<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <input type="text">
        <button onclick="qiuhe()">求和</button>
<span id="id"></span>
    </div>
</body>
</html>
<script>
let oSum=document.getElementById('id');

function qiuhe(){
    console.log(1);
    var sum = 0;
                var arr = document.getElementsByTagName("input")[0].value.split(",");
                console.log(arr);
                for (var i in arr) {
                    sum += parseInt(arr[i]);
                }
                oSum.innerHTML = sum;
}
      
</script>